export const User = {
    state: {
      user:{},
      userlist:{},
      token:null
    },
    
    mutations: {

      INITUSER(state, user) {
        state.user = user;
      },
      INITUSERINFO(state, userlist) {
      
        state.userlist = userlist;
      },
      DELEUSER(state){
        state.user=''
      },
      DELEUSERINFO(state){
        state.userinfo=''
      },
       //保存token
    SAVE_TOKEN(state,token){
      state.token = token
  },
  REMOVE_TOKEN(state){
      state.token = null
  },
    },
    actions: {
      initUser({ commit }, user) {
        commit("INITUSER", user);
      },
      userList({ commit }, userinfo) {
        console.log('>>>>>>userinfo',userinfo);
        commit("INITUSERINFO", userinfo);
      },
      deleUser({commit}){
         commit("DELEUSER")
      },
      deleUserInfo({commit}){
        commit("DELEUSERINFO")
              },
     
  saveToken({commit},token){
    commit('SAVE_TOKEN',token)
},
removeToken({commit}){
    commit('REMOVE_TOKEN')
}
      
    },
  };